% TEST_ID: LANG-EXPAND-0071
% CATEGORY: language/reflection
% 测试 exist 函数

function test_exist
    assert(isequal(exist('x'), 0))
    assert(isequal(exist('test_exist.m'), 2))

    % 工作目录下的文件夹
    assert(isequal(exist('language'), 7))
    x = 1;
    assert(isequal(exist('x'), 1))
    assert(isequal(exist('exist'), 5))
    persistent p1
    global p2
    assert(isequal(exist('p1'), 1))
    assert(isequal(exist('p2'), 1))
    clear all
end